from typing import List


class Solution:
    def numberOfWeeks(self, milestones: List[int]) -> int:
        max_val = max(milestones)
        sum_val = sum(milestones)
        return min(sum_val, (sum_val - max_val) * 2 + 1)


if __name__ == "__main__":
    print(Solution().numberOfWeeks([1, 2, 3]))  # 6
    print(Solution().numberOfWeeks([5, 2, 1]))  # 7
